package com.example.passwordmanager;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.databinding.ViewDataBinding;
import androidx.lifecycle.Observer;

import com.Ohuang.ilivedata.MyLiveData;
import com.example.passwordmanager.databinding.ActivityShowPsdBinding;
import com.example.passwordmanager.db.UserBean;

public class ShowPsdActivity extends BaseActivity {
    ActivityShowPsdBinding binding;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding= ActivityShowPsdBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        MyLiveData.getInstance().with("showPsd", UserBean.class).observe(this, new Observer<UserBean>() {
            @Override
            public void onChanged(UserBean userBean) {
                binding.etName.setText(userBean.getName());
                binding.etUsername.setText(userBean.getUsername());
                binding.etPassword.setText(userBean.getPassword());
                binding.etContent.setText(userBean.getContent());
                binding.etSecretKey.setText(userBean.getSecretKey());
            }
        });
    }
}
